<!DOCTYPE html>
<html>
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 
  <title>Promise</title>
  <style type="text/css">
  * {
        padding: 0;
        margin: 0;
    }
    </style>
</head>
<body>
   <div class="box">
     <h2>Promise</h2>
   </div>
  <script src="index.js"></script>
  <script src="php/ajax.js"></script>
  <script type="text/javascript">
 

var type = class {
  static then(resolve, reject) {
    setTimeout(() => {
      reject("解决状态");
    }, 2000);
  }
}

/*
console.log(type, typeof type, Object.prototype.toString.call(type))
type.then((data) => {
  console.log('data = ', data)
})
console.log('-----------------------\n')
*/


Promise.resolve(type).then(v => {
  console.log('value = ', v)
}, r => {
  console.warn('r = ',r)
})




  </script>
</body>
</html>